package com.liyiruo.processor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * bean后置处理器
 * @author liyiruo
 * @Description
 * @Date 2023/4/20 下午10:36
 */
public class MyBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {

        System.out.println("bean后置处理器-BeforeInitialization");
        System.out.println("bean :"+bean+"beanName:"+beanName);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("bean :"+bean+"beanName:"+beanName);
        System.out.println("bean后置处理器-AfterInitialization");
        return bean;
    }
}
